import { takeEvery, put } from 'redux-saga/effects'
import { SET_PRODUCT, GET_PRODUCT } from '../actions/product.action'
import axios from 'axios'

function* getProducts() {
  const { data } = yield axios.get('http://localhost:3005/goods')
  yield put(SET_PRODUCT(data))
}

export default function* productSaga() {
  yield takeEvery(GET_PRODUCT, getProducts)
}